#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
int a[N];
ll sum, cnt;
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int n;
		cin >> n;
		sum = 0;
		cnt = 0;
		for (int i = 1; i <= n; i++)
			cin >> a[i];
		int flag = 0;
		for (int i = 1; i <= n; i++)
		{
			if (a[i] > 0)
			{
				flag = 0;
				sum += a[i];
			}
			else
			{
				sum -= a[i];
				if (a[i] < 0 && flag == 0)
				{
					flag = 1;
					cnt++;
				}
			}
		}
		cout << sum << " " << cnt << endl;
	}
	return 0;
}